package com.fastjars.business.captcha;

import org.patchca.font.RandomFontFactory;
import org.patchca.service.AbstractCaptchaService;
import org.patchca.text.renderer.BestFitTextRenderer;
import org.patchca.word.AdaptiveRandomWordFactory;

/**
 * CaptchaService
 *
 * @author Brant Liu <br> 邮箱：<br>lbf1988@qq.com <br>日期：<br>2018/06/13
 * @version 1.0.0
 */
public class CaptchaService extends AbstractCaptchaService {

    public CaptchaService(Config conf) {
        setColorFactory(conf.getFontColorFactory());
        setFilterFactory(conf.getFontFilterFactory());
        setFontFactory(new RandomFontFactory());
        setTextRenderer(new BestFitTextRenderer());
        setWordFactory(new AdaptiveRandomWordFactory());
        setBackgroundFactory(conf.getBackgroundFactory());
        setWidth(conf.getWidth());
        setHeight(conf.getHeight());
    }
}
